<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>E朝朝注册</title>
    <link rel="shortcut icon" href="http://leyikao.cn:80//favicon.ico">
    <link href="${base}/resources/css/denglu.css" rel="stylesheet">
    <script src="${base}/resources/js/jquery-1.4.4.js"></script>
    <script type="text/javascript" src="${base}/resources/js/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="${base}/resources/js/layer/layer.js"></script>
</head>

<body>
<div class="header">
    <div class="logo_wrap">
         <h1><a href="${base}/welcome"><img src="${base}/resources/images/logo.png" alt="E朝朝企业版" style="border:none"></a></h1>
    </div>
</div>
<div class="container">
    <div class="content101">
        <div class="content_left101">
            <h1>校招神器神器</h1>
            <h4>校招神器</h4>
            <h2>校招神器神器</h2>
        </div>
        <div class="content_right101">
            <!--登陆注册 开始-->
            <div class="hhh101" >
                <div class="head101">
                    <a href="" class="zhuce101" id="zhuce" style="color: #2492ea;" >注册</a>
                    <a href="${base}/enterprise/login" class="denglu101" id="denglu" onclick="qie()" style="background-color: #bec0bc;color: #fff;">登录</a>
                </div>
                <div class="rege101">
                    <ul>
                        <li class="phone101"><span>手 机 号:</span><input type="text" placeholder="手机号" id="phone" onkeyup="this.value=this.value.replace(/\D/g,'')" maxlength='11'></li>
                        <li class="pass101"><span>设置密码:</span><input type="password" value="" placeholder="请输入6—16位数字和字母组合的密码" id="paw"  maxlength='16'></li>
                        <li class="pass101"><span>确认密码:</span><input type="password" value="" placeholder="输入密码" id="chePaw" maxlength='16'></li>
                        <li class="yanzh101"><span>验 证 码:</span><input  type="text" placeholder="验证码" id="verifyCode">
						<input type="button" id="btn" value="获取验证码" style="padding:0px;width: 116px;height: 43px;line-height: 36px;
margin-left: 40px;" /></li>
                    </ul>
                    <div class="checkbox101">
                        <ul>
                            <li class="remember101">
                            <span class="checked101"><img src="${base}/resources/images/checked.png"></span>
							<span class="check101" style="display:none;"><img src="${base}/resources/images/check.png"></span>接受<a href="${base}/enterprise/serviceAgreement">用户服务协议</a></li>
                        </ul>
                    </div>
                    <div class="submit101" id="Registered">
                        <span>免费注册</span>
                    </div>
                </div>
            </div>
            <!--登陆注册 结束-->

        </div>
    </div>
</div>
 <#include "../common/bottom.ftl">
<script>
	$base = "${base}";
	var chefuwu=1;
	var index1="";
    $(".checked101").click(function(){
        $(".check101").toggle();
        $(".checked101").toggle();
        chefuwu=0;
    });
    $(".check101").click(function(){
        $(".checked101").toggle();
        $(".check101").toggle();
        chefuwu=1;
    })
    $(document).keydown(function(event){ 
		if(event.keyCode == 13){ //绑定回车 
			 if(index1!=""&&index1!=null){
				   layer.close(index1);
		           index1="";
		     }else{
		    	 $("#Registered").click();	
		     }
		} 
	}); 

     //
   document.getElementById("btn").onclick=function(){
    	var phone = $("#phone").val();
    	if(!upperCase()){
    		return;
    	}
 	    $.post($base + '/enterprise/verifyCode',{
 			'phone':phone,
 		},function(data){
 			if(data.result==0){
 				index1 = layer.alert(data.message, {icon: 2,skin: 'layer-ext-moon'});
 				$("#verifyCode").focus();
 			}else{
 				index1 = layer.alert("验证码已发送，请注意查收!", {icon: 1,skin: 'layer-ext-moon'});
 				time(document.getElementById("btn")); 
 				 $("#verifyCode").focus();
 			}
 		});
      }
     //注册
     $("#Registered").click(function(){
    	 if(chefuwu==0){
    		 index1 = layer.alert("请阅读服务协议！", {icon: 0,skin: 'layer-ext-moon'});
    		 return false;
    	 }
     	var phone = $("#phone").val();
 	    if(phone == null || phone == ''){
 	    	index1 = layer.alert("手机号不能为空!", {icon: 0,skin: 'layer-ext-moon'});
 	            	$("#phone").focus();
 	            	return false;
 	    }
 	   var chephone =/1[34578]{1}\d{9}$/;
		if((phone != null && phone != '')&&!chephone.test(phone)){
			index1 = layer.alert("请输入正确的手机号!", {icon: 0,skin: 'layer-ext-moon'});
			return false;
		}
 	    var paw = $("#paw").val();
 	    if(paw == null || paw == ''){
 	    	index1 = layer.alert("密码不能为空!", {icon: 0,skin: 'layer-ext-moon'});
 	           $("#paw").focus()
 	           return false;
 	    }else{
 	    	var chePassword =/^(?=.{6,16})(?=.*[a-z])(?=.*[0-9])[0-9a-z]*$/;
 			if(!chePassword.test(paw)){
 				index1 = layer.alert("请输入6—16位数字和字母组合!", {icon: 0,skin: 'layer-ext-moon'});
 				return false;
 			}
 	    }
 	   var chePaw = $("#chePaw").val();
	    if(chePaw!=paw){
	    	index1 = layer.alert("密码和确认密码不同!", {icon: 0,skin: 'layer-ext-moon'});
	           $("#paw").focus();
	           return false;
	    }
 	    var verify = $("#verifyCode").val();
 	    if(verify == null || verify == ''){
 	    	index1 = layer.alert("验证码不能为空!", {icon: 0,skin: 'layer-ext-moon'});
 	           $("#verifyCode").focus();
 	           return false;
 	    }else{
 	    	$.post($base + '/enterprise/verify',{
	 			'phone':phone,
	 			'verify':verify
	 		},function(data){
	 			if(data.result==0){
	 				index1 = layer.alert(data.message, {icon: 2,skin: 'layer-ext-moon'});
	 				return false;
	 			}else{
	 				$.post($base + '/enterprise/register',{
	 		 			'phone':phone,
	 		 			'paw':paw,
	 		 			'verify':verify
	 		 		},function(data){
	 		 			if(data.result==1){
	 		 				index1 = layer.alert('注册成功!', {
	 							icon: 1,
	 						    skin: 'layui-layer-moon' 
	 						    ,closeBtn: 0
	 						}, function(){
	 							window.location="${base}/enterprise/login";
	 						});
	 		 			}else{
	 		 				index1 = layer.alert(data.message, {icon: 2,skin: 'layer-ext-moon'});
	 		 			}
	 		 		});
	 			}
	 		});
 	    }
     })
     function upperCase(){
    	 var phone = $("#phone").val();
    	 var flag=true;
    	 var chephone =/1[34578]{1}\d{9}$/;
			if(!chephone.test(phone)){
				index1 = layer.alert("请输入正确的手机号!", {icon: 0,skin: 'layer-ext-moon'});
				flag =false;
			}
			return flag;
     }

</script>
<script type="text/javascript">
    var wait=60;
    function time(t) {
        if (wait == 0) {
            t.removeAttribute("disabled");
            t.value="获取验证码";
            wait = 60;
        } else {
            t.setAttribute("disabled", true);
            t.value="重新发送(" + wait + ")";
            wait--;
            setTimeout(function() {
                        time(t)
                    },
                    1000)
        }
    }
 
</script>
</body>
</html>